home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / exampleCode / viewkit / VCal / DayView.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  4.9 KB  |  152 lines

  1. /*
  2.  * Copyright (C) 1994, Silicon Graphics, Inc.
  3.  * All Rights Reserved.
  4.  *
  5.  * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  6.  * the contents of this file may not be disclosed to third parties, copied or
  7.  * duplicated in any form, in whole or in part, without the prior written
  8.  * permission of Silicon Graphics, Inc.
  9.  *
  10.  * RESTRICTED RIGHTS LEGEND:
  11.  * Use, duplication or disclosure by the Government is subject to restrictions
  12.  * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  13.  * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  14.  * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  15.  * rights reserved under the Copyright Laws of the United States.
  16.  */
  17. #ifndef _DAY_VIEW_
  18. #define _DAY_VIEW_
  19.  
  20. #include <Vk/VkWindow.h>
  21. #include <Vk/VkApp.h>
  22. #include <Vk/VkScroll.h>
  23. #include "TimeEntry.h"
  24. #include "TimeGrid.h"
  25.  
  26. class VCal;
  27. class MemoryInfo;
  28. class Entry;
  29. class RepeatingEntry;
  30. class EntryDialog;
  31. class VkRepeatButton;
  32. class VkPopupMenu;
  33. class VkMenu;
  34. class VkMenuItem;
  35.  
  36. typedef struct {
  37.   EntryDialog *dialog;
  38.   TimeEntry *time;
  39. } DayViewInfo;
  40.  
  41. class DayView : public VkWindow {
  42. public:
  43.   DayView(VCal *owner, const char *docName);
  44.   ~DayView();
  45.  
  46.   virtual const char* className();
  47.  
  48.   int day() { return _day; }
  49.   int month() { return _month; }
  50.   int year() { return _year; }
  51.   void selectDate(int day, int month, int year, MemoryInfo *dayInfo,
  52.           RepeatingEntry *repeating);
  53.   void unselect();
  54.   MemoryInfo *info() { return _info; }
  55.   RepeatingEntry *repeating() { return _repeating; }
  56.   void entryChanged(EntryDialog *);
  57.   int eraseEntry(Entry *entry);
  58.   void updateTime();
  59.   void scrollToCurrentTime();
  60.   void scrollToBeginning();
  61.   void scrollToTime(int time);
  62.  
  63. protected:
  64.   virtual Widget setUpInterface(Widget parent);
  65.   virtual void handleWmDeleteMessage();
  66.  
  67.   void fileMenu();
  68.   void displayMenu();
  69.   void entryMenu();
  70.   void updateHeader();
  71.   void initialExpose();
  72.   void restrictedChanged(Boolean restricted);
  73.   void notifyOwner(Entry *entry, Entry *oldEntry = NULL);
  74.   void scrollProc(Widget w, XtPointer client_data, XtPointer call_data);
  75.   void drawTrough(VkScrollCallback *cb);
  76.   void annotateEntry(Entry *entry, int width, int height, Pixmap pixmap);
  77.   void doDayPrev(Widget w, XtPointer client_data, XtPointer call_data);
  78.   void doDayNext(Widget w, XtPointer client_data, XtPointer call_data);
  79.   void displayToday();
  80.   void weekdayMenu(VkMenu *parent);
  81.   void selectWeekday(int day);
  82.  
  83.   void initEntries();
  84.   void displayEntries();
  85.   void hideEntries();
  86.   void eraseEntries();
  87.   void initEntry(Entry *entry);
  88.   void displayEntry(Entry *entry);
  89.   void hideEntry(Entry *entry);
  90.   void entryCallback(Widget w, TimeEntryCallback *cb);
  91.   Entry *findEntry(Widget w);
  92.   void entryModified(Entry *entry, TimeEntryReason reason);
  93.   void deleteEntry(Entry *entry);
  94.   void doQuit();
  95.   void gridCallback(TimeGridCallback *cb);
  96.   Entry *createEntry(int start, int length);
  97.   void selectEntry(Entry *entry, Boolean makeModified = False);
  98.   void entryDialog(Entry *entry);
  99.   Entry *findDialogEntry(EntryDialog *dialog);
  100.   void removeEntry(Entry *entry);
  101.   void addEntry(Entry *entry);
  102.   void scheduleResetState();
  103.   void setMenuEntry(TimeEntry *entry);
  104.   void entryAttributesMenu();
  105.   void entryDeleteMenu();
  106.  
  107.   static void quit_menu(Widget w, XtPointer client_data, XtPointer call_data);
  108.   static void restricted_menu(Widget w, XtPointer client_data,
  109.                   XtPointer call_data);
  110.   static void day_select(Widget w, XtPointer client_data, XEvent *event);
  111.   static void weekday_menu(Widget w, XtPointer client_data,
  112.                XtPointer call_data);
  113.   static void entry_stub(Widget w, XtPointer client_data, XtPointer call_data);
  114.   static void grid_stub(Widget w, XtPointer client_data, XtPointer call_data);
  115.   static void attributes_menu(Widget w, XtPointer client_data,
  116.                   XtPointer call_data);
  117.   static void delete_menu(Widget w, XtPointer client_data,
  118.               XtPointer call_data);
  119.   static Boolean reset_state(XtPointer call_data);
  120.   static void save_text(Widget w, XtPointer client_data, XtPointer call_data);
  121.   static void display_overview(Widget w, XtPointer client_data,
  122.                    XtPointer call_data);
  123.   static void entry_attributes(Widget w, XtPointer client_data,
  124.                    XtPointer call_data);
  125.   static void entry_delete(Widget w, XtPointer client_data,
  126.                    XtPointer call_data);
  127.  
  128.   Widget form, header, tsForm;
  129.   VkRepeatButton *dayPrev, *dayNext;
  130.   VCal *owner;
  131.   int numSlots, timeInterval, subdivisions, timeSlotSnap;
  132.   int _day, _month, _year, _lastTime;
  133.   MemoryInfo *_info;
  134.   RepeatingEntry *_repeating;
  135.   Boolean restricted;
  136.   int restrictStart, restrictEnd;
  137.   XtCallbackProc callback;
  138.   caddr_t callbackData;
  139.   VkScroll *scroll;
  140.   int scrollCount;
  141.   GC troughGC, timeGC, tileGC;
  142.   Pixmap tile;
  143.   TimeGrid *grid;
  144.   int defaultLength;
  145.   VkPopupMenu *entryPopup, *repeatingEntryPopup;
  146.   Entry *menuEntry;
  147.   VkMenuItem *entryAttrItem, *entryDeleteItem, *entryDeleteEverywhereItem;
  148.   TimeEntry *lastMenuEntry;
  149. };
  150.  
  151. #endif
  152.